import { getMenuList } from "../../../request/api"

interface menuState {
    menuList: Array<object>
}
const state = {
    menuList: []
}
const getters = {
    getMenu(state: menuState) {
        
        return state.menuList
    }
}
const mutations = {
    REQ_MENU(state:menuState,payload:any){
        state.menuList=payload
    }
}
const actions = {
    changeMenuAction({commit}:any){
        getMenuList().then((res:any)=>{
            commit('REQ_MENU',res.data.list)
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}